import Vue from 'vue'
import VueRouter from 'vue-router'

import loginPager from "@/view/login/loginPager.vue";
import homePager from "@/view/home/homePager.vue";
import detailPager from "@/view/detail/detailPager.vue";


// 使用 VueRouter
Vue.use(VueRouter)

const routes = [
    {
        path: '/login',
        name: 'loginPager',
        component: loginPager,
    },
    {
        path: '/home',
        name: 'homePager',
        component: homePager,
        children:[
            {
                path: 'dataAnalysis',
                component: () => import('@/view/home/dataAnalysis/data_analysis.vue'),
            },
            {
                path: 'goodsList',
                component: () => import('@/view/home/goods/goodsList.vue'),
            },
            {
                path: 'addGood',
                component: () => import('@/view/home/goods/addGood.vue'),
            },
        ]
    },
    {
        path: '/detail',
        name: 'detailPager',
        component: detailPager,
    },
]

const router = new VueRouter({
    mode: 'history', // 使用 history 模式
    routes,
})

export default router
